Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/area

Package Overview
Dependencies
Maintainers
9
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/area

turf area module

  • 7.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1M
increased by28.71%
Maintainers
9
Weekly downloads
 
Created

What is @turf/area?

@turf/area is a module from the Turf.js library that allows you to calculate the area of GeoJSON polygons. It is useful for geospatial analysis and can handle complex polygons, including those with holes.

What are @turf/area's main functionalities?

Calculate area of a simple polygon

This feature allows you to calculate the area of a simple polygon. The code sample demonstrates how to create a polygon and calculate its area using the @turf/area module.

const turf = require('@turf/turf');
const polygon = turf.polygon([[
  [-74.0059413, 40.7127837],
  [-73.935242, 40.730610],
  [-73.944158, 40.678178],
  [-74.0059413, 40.7127837]
]]);
const area = turf.area(polygon);
console.log(area);

Calculate area of a polygon with holes

This feature allows you to calculate the area of a polygon that contains holes. The code sample demonstrates how to create such a polygon and calculate its area using the @turf/area module.

const turf = require('@turf/turf');
const polygonWithHole = turf.polygon([[
  [-74.0059413, 40.7127837],
  [-73.935242, 40.730610],
  [-73.944158, 40.678178],
  [-74.0059413, 40.7127837]
], [
  [-73.965242, 40.7127837],
  [-73.955242, 40.7227837],
  [-73.945242, 40.7127837],
  [-73.965242, 40.7127837]
]]);
const area = turf.area(polygonWithHole);
console.log(area);

Other packages similar to @turf/area

Keywords

FAQs

Package last updated on 09 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc